﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:viewModels="clr-namespace:Bull.Plugins.Market.ViewModels;assembly=Bull.Plugins.Market.ViewModels">

    <DataTemplate DataType="{x:Type viewModels:QuoteViewModel}" x:Key="BackDataTemplate">
        <Grid Margin="0,0,0,1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>
            <Border Background="#72BBEF">
                <TextBlock Text="{Binding Size}" Foreground="#333" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center"/>
            </Border>
            <Button Content="{Binding Price}" Grid.Column="1"/>
        </Grid>
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewModels:QuoteViewModel}" x:Key="LayDataTemplate">
        <Grid Margin="0,0,0,1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>
            <Button Content="{Binding Price}" Grid.Column="1"/>
            <Border Grid.Column="2" Background="#FAA9BA">
                <TextBlock Text="{Binding Size}" Foreground="#333" Margin="5,0,0,0" VerticalAlignment="Center"/>
            </Border>
        </Grid>
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewModels:RunnerViewModel}">
        <Border BorderBrush="#cdcdcd" BorderThickness="1" CornerRadius="1" Margin="0,0,5,0">
            <StackPanel>
                <TextBlock Text="{Binding Name}" />
                <StackPanel>
                    <ItemsControl ItemsSource="{Binding Lay}" ItemTemplate="{StaticResource LayDataTemplate}" />
                    <ItemsControl ItemsSource="{Binding Back}" ItemTemplate="{StaticResource BackDataTemplate}" />
                </StackPanel>
            </StackPanel>
        </Border>
    </DataTemplate>

    <DataTemplate DataType="{x:Type viewModels:MarketBookViewModel}">
        <StackPanel>
            <TextBlock Text="{Binding Description}" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ItemsControl ItemsSource="{Binding Runners}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
            </Grid>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>